[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
iscntrl() Test for Control Character (Macro)
#include <ctype.h>
int iscntrl(c);
int c; Integer value to be tested
iscntrl() tests whether 'c' is a delete or control character; that
is, if it is in the range 0 - 31 or 127 (0x00 - 0x1f or 0x7f).
Returns: True (nonzero) if the integer satisfies the test
condition or false (zero) if it does not. The result
is undefined if 'c' is other than an ASCII character
or EOF.
Notes: iscntrl() is a macro.
iscntrl() produces a defined result only where
isascii() holds true or for the non-ASCII value EOF
(defined in <stdio.h>).
-------------------------------- Example ---------------------------------
The following statements open a file and read in characters until a
control character is read. The characters are printed to the screen.
#include <ctype.h>
#include <stdio.h> /* for fopen */
FILE *stream;
int ch;
main()
{
if ((stream = fopen("input.dat","r+")) != NULL) {
while (!iscntrl(ch = getc(stream)))
printf("%c ",ch);
}
}
See Also:
isalnum()
isalpha()
isascii()
isdigit()
isgraph()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson